CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

PROJECT(GlassHole)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

option(NOCRT "link crt static" OFF)


if (MSVC)
    #warning 4251
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4819 /wd4996 ")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4819 /wd4996 ")
	
	if (NOCRT)
		set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DWIN32 /MTd")
		set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DWIN32 /MT")
	endif()
	
	set(CMAKE_SHARED_LINKER_FLAGS_DEBUG   "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
	set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /OPT:NOREF /OPT:ICF /SAFESEH:NO")
	
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/lib)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/lib)

    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin)
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/lib)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/lib)
else()
	#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
	#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake 
		${CMAKE_MODULE_PATH}
		"E:/opencv/build/x64/vc14/lib")

find_package(OpenCV REQUIRED)

#SET(QT_ROOT "E:/Qt/Qt5.8.0_x64/5.8/msvc2015_64")
#SET(QtCore_DIR ${QT_ROOT}/include)
include(cmake/qt.cmake)

if (NOT QT_ROOT)
	MESSAGE(WARNING "QT NOT Found")
endif ()
MESSAGE("QT_ROOT: ${QT_ROOT}")

SET(CMAKE_PREFIX_PATH ${QT_ROOT})

message("---------${OpenCV_DIR}")
message("---------${OpenCV_INCLUDE_DIRS}")
message("---------${OpenCV_LIBS}")


set(PROJECT_ROOT ${PROJECT_SOURCE_DIR})
set(COMN_DIR ${PROJECT_ROOT}/comn)
set(THIRD_PARTY ${PROJECT_ROOT}/third_party)



if (CMAKE_HOST_WIN32)
    set(LIB_PLATFORM ws2_32 )
else()
    set(LIB_PLATFORM pthread rt)
endif()


ADD_SUBDIRECTORY(comn)

ADD_SUBDIRECTORY(DemoCount)

ADD_SUBDIRECTORY(GlassHole)

